package com.corona.game.util.texture;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import java.util.HashMap;
import java.util.Map;

/* loaded from: pokewilds.jar:com/pkmngen/game/util/texture/StaticTextures.class */
public class StaticTextures {
    private static final String PREFIX;
    private static final Map<String, TextureAtlas.AtlasRegion> tilesCache = new HashMap();

    public static TextureAtlas.AtlasRegion getOrCreate(String name) {
        if (tilesCache.containsKey(name)) {
            return tilesCache.get(name);
        }
        FileHandle file = Gdx.files.local("mods/tiles/" + name + ".png");
        if (!file.exists()) {
            file = Gdx.files.internal("tiles/" + name + ".png");
        }
        Pixmap pixmap = new Pixmap(file);
        TilesAtlas.pack(PREFIX, name, pixmap);
        TilesAtlas.update();
        pixmap.dispose();
        TextureAtlas.AtlasRegion region = TilesAtlas.get(PREFIX, name);
        tilesCache.put(name, region);
        return region;
    }
}
